﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 物品
/// </summary>
public class Article {

    /// <summary>
    /// 物品id
    /// </summary>
    public string ArticleId { get; set; }
    /// <summary>
    /// 物品模板id
    /// </summary>
    public string ArticleTempletId { get; set; }
    /// <summary>
    /// 物品模板
    /// </summary>
    public ArticleTemplet ArticleTemplet { get; set; }
    /// <summary>
    /// 品质
    /// </summary>
    public Constant.ArticleQuality ArticleQuality { get; set; }
    /// <summary>
    /// 购买价格
    /// </summary>
    public int BuyPrice { get; set; }
    /// <summary>
    /// 出售价格
    /// </summary>
    public int SellPrice { get; set; }
    /// <summary>
    /// 攻击力
    /// </summary>
    public int Attack { get; set; }
    /// <summary>
    /// 防御力
    /// </summary>
    public int Defense { get; set; }
    /// <summary>
    /// 生命
    /// </summary>
    public int Hp { get; set; }
    /// <summary>
    /// 内力
    /// </summary>
    public int Mp { get; set; }
    /// <summary>
    /// 体力
    /// </summary>
    public int Vit { get; set; }
    /// <summary>
    /// 速度
    /// </summary>
    public int Speed { get; set; }

    /// <summary>
    /// 物品名称
    /// </summary>
    public string Name { get; set; }
    /// <summary>
    /// 物品描述
    /// </summary>
    public string Intro { get; set; }
    /// <summary>
    /// 物品种类名称
    /// </summary>
    public string CategoryName { get; set; }

    public Article() {
        this.ArticleId = StringHelper.generateUUID();
    }

    public Article(ArticleTemplet articleTemplet) : this() {
        this.ArticleTempletId = articleTemplet.ArticleTempletId;
        this.ArticleTemplet = articleTemplet;
    }

    public Article(ArticleTemplet articleTemplet, Constant.ArticleQuality articleQuality) : this(articleTemplet) {
        this.ArticleQuality = articleQuality;
    }

    /// <summary>
    /// 根据人物属性判断能否装备
    /// </summary>
    /// <param name="person">人物</param>
    /// <returns>List 不满足的条件（为空时表示满足)</returns>
    public List<Constant.RequireCategory> AbleEquip(Personage personage) {
        return GameHelper.GetDisSatisfactory(personage, this.ArticleTemplet.RequireConditions);
    }
}
